/*
 * Created on 28/mag/07
 *
 * To change the template for this generated file go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
package it.unibo.deis.lia.mmhc.util;

import it.unibo.deis.lia.networkInterface.*;
import it.unibo.deis.lia.location.*;

import java.io.*;

public class Connector implements Serializable {

	private static final long serialVersionUID = 1L;

	private GenericNetworkInterface localNetworkInterface;
	private Location connectorDescription;
	private float enduranceEstimation;
	private float overallValue;
	private boolean isFixed;
	private float coverageRange = -1;
	private float powerConsumption = -1;
	private boolean multipleChannels;
	private float throughputKBs;

	public Connector(GenericNetworkInterface localNetworkInterface,
			Location connectorDescription, float coverageRange,
			float powerConsumption, boolean multipleChannels, boolean isFixed,
			float throughputKBs) throws Exception {
		this.localNetworkInterface = localNetworkInterface;
		this.connectorDescription = connectorDescription;

		this.coverageRange = coverageRange;
		this.powerConsumption = powerConsumption;
		this.multipleChannels = multipleChannels;
		this.isFixed = isFixed;
		this.throughputKBs = throughputKBs;
	}

	public GenericNetworkInterface getLocalNetworkInterface() {
		return localNetworkInterface;
	}

	public Location getConnectorDescription() {
		return connectorDescription;
	}

	public boolean isFixed() {
		return isFixed;
	}

	public boolean isMobile() throws Exception {
		return !this.isFixed();
	}

	public float getEnduranceEstimation() {
		return enduranceEstimation;
	}

	public void setEnduranceEstimation(float newEndurance) {
		this.enduranceEstimation = newEndurance;
	}

	public float getOverallValue() {
		return overallValue;
	}

	public void setOverallValue(float newOverallValue) {
		this.overallValue = newOverallValue;
	}

	public float getCoverageRange() {
		return coverageRange;
	}

	public float getPowerConsumption() {
		return powerConsumption;
	}

	public boolean isMultipleChannels() {
		return multipleChannels;
	}

	public float getThroughputKBs() {
		return throughputKBs;
	}

	public String toString() {
		/*
		 * private float endurance; private float overallValue; private boolean
		 * isFixed; private float coverageRange=-1; private float
		 * powerConsumption=-1; private boolean multipleChannels=false;
		 */
		return "isFixed=" + isFixed + " endurance=" + enduranceEstimation
				+ " overallValue=" + overallValue + " connectorDescription="
				+ connectorDescription + " @ ( " + localNetworkInterface + " )";
	}
}
